<?php
namespace jy_weishop;
defined('BY_JYA') or exit('error');
/*
	消息提醒
*/
class notice extends \plugin{
	public function gettpl_data($orderid,$type=0){//type=0表单订单，type=1
		return $datas;
	}
	public function notice_yuyueorder($order,$url=''){
		//预约成功消息		
		$template_id=cfc('account')->get_tpl_template_id('OPENTM405653850','预约成功消息');
		if($_SESSION['wxapp_id']){
			$wxapptemplate_id=cfc('wxapp_api')->get_tpl_template_id('3534',[1,2],'yuyueorder','预约成功消息','jy_meye');
		}
		$serve=pdo_get('jy_meye_serve',array('id'=>$order['serve_id'],'uniacid'=>$_SESSION['uniacid']));
		$serve_title=$serve['title'];
		$serve_times=json_decode($serve['serve_time'],true);
		$serve_time=$serve_times[$order['timeid']];
		$serve_timetitle=$order['day'].':'.$serve_time['times']['start'].'~'.$serve_time['times']['end'];
		$message=array(
			'first'=>array('value'=>'预约服务成功！',"color" => "#4a5077"),
			'keyword1'=>array('value'=>$serve_title,"color" => "#4a5077"),
			'keyword2'=>array('value'=>$serve_timetitle,"color" => "#4a5077"),
			'remark'=>array('value'=>'谢谢惠顾！请留意预约进度信息！点击“详情”查看预约信息。',"color" => "#4a5077"),
		);
		if(!$url){
			$url=custom_url('jy_meye/server_order/list/status=1&id='.$order['id'],true);	
		}
		if(method_exists(cfc('account'),'sendtwoNotice')){
			cfc('account')->sendtwoNotice($order['mid'],$template_id,$message,$url,'yuyueorder','jy_meye',$order['id']);
		}
	}
}
